package org.road0329.tools.proto_parse_tool.ems.xintian.utils;

import org.road0329.tools.proto_parse_tool.chargingpile.MsgDcsResult;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2018-09-13.
 */
@Component
public class XinTianConfirmUtil {

    public static MsgDcsResult parseACKData(byte[] msg, int from, boolean acd) {
        int index = from;
        index++; //跳过seq
        MsgDcsResult gwResult = new MsgDcsResult();
        if (msg[index] == 0x01) {
            gwResult.setMessage("全部确认");
            gwResult.setSuccess(true);
            index++;
        } else if (msg[index] == 0x02) {
            gwResult.setMessage("全部否认");
            gwResult.setSuccess(false);
            index++;
        } else {
            gwResult.setMessage("未知错误");
            gwResult.setSuccess(false);
        }
        return gwResult;
    }

}
